# Backend Dockerfile for Flask-SocketIO Spotify service
FROM python:3.11-slim

# Prevent interactive prompts
ENV PYTHONUNBUFFERED=1

# Set working directory
WORKDIR /app

# Install Python dependencies first (leveraging Docker layer cache)
COPY requirements.txt ./
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Install FFmpeg for SpotDL downloads - CRITICAL FIX
RUN spotdl --download-ffmpeg

# Copy rest of backend source
COPY . /app

EXPOSE 5144

CMD ["python", "app.py"]
